str1 = input('>>>输入字符串')
str2 =''
list1 = [] #统计出现的字符
result = [] #结果
for i in str1:
    str_count = 0
    if i not in list1:
        list1.append(i)
        str_count = str1.count(i) 
        str2 = "\"" + i + "\"" + ':' + str(str_count)
        result.append(str2)

lenth = len(result)
#冒泡排序
for i in range(lenth):
    flag = True
    for j in range(lenth-1-i):
        if int(result[j][4]) > int(result[j+1][4]):
            temp = result[j]
            result[j] = result[j+1]
            result[j+1] = temp
            flag = False
    if flag:
        break

re_sort=result.reverse()
#print("输入字符次数降序排列" + result[])
print("输入字符次数降序排列",result)
for i in range(3):
    print("输入字符最多第%s个元素" % (i+1) + result[i])
